import Vue from 'vue'
import VueRouter from 'vue-router';
import Home from './pages/home'
import Index from './pages/index'
// import Product from './pages/product'
// import Detail from './pages/detail'
// import Cart from './pages/cart'
// import Order from './pages/order'
// import OrderConfirm from './pages/orderConfirm'
// import OrderList from './pages/orderList'
// import OrderPay from './pages/orderPay'
// import Alipay from './pages/alipay'
// import Login from './pages/login'


Vue.use(VueRouter);


export default new VueRouter({
   routes:[
       {
         path:'/',
         name:'home',
         component:Home,
         redirect:'/index',
         children:[
           {
            path:'/index',
            name:'index',
            component:Index,
           },
           {
            path:'/product/:id',
            name:'product',
            // component:Product,
            component:resolve=>require(['./pages/product.vue'],resolve),
           },
           {
            path:'/detail/:id',
            name:'detail',
            // component:Detail,
            component:(resolve)=>require(['./pages/detail.vue'],resolve)
            
           },
         ]
       },
       {
        path:'/login',
        name:'login',
        // component:Login,
        component: () => import(/* webpackChunkName: "login" */ './pages/login')
        
       },
       {
        path:'/cart',
        name:'cart',
        // component:Cart,
        component: () => import(/* webpackChunkName: "login" */ './pages/cart')
       },
       {
        path:'/order',
        name:'order',
        // component:Order,
        component: () => import(/* webpackChunkName: "order" */ './pages/order'),
        children:[
            {
                path:'list',
                name:'order-list',
                // component:OrderList,
                component: () => import(/* webpackChunkName: "list" */ './pages/orderList')
            },
            {
                path:'confirm',
                name:'order-confirm',
                // component:OrderConfirm,
                component: () => import(/* webpackChunkName: "confirm" */ './pages/orderConfirm')
            },
            {
                path:'pay',
                name:'order-pay',
                // component:OrderPay,
                component: () => import(/* webpackChunkName: "pay" */ './pages/orderPay')
            }, 
            {
                path:'alipay',
                name:'alipay',
                // component:Alipay,
                component: () => import(/* webpackChunkName: "alipay" */ './pages/alipay')
            }
        ]
       },
   ]
});